<%-- 
    Document   : index
    Created on : 22.05.2012, 09:35:18
    Author     : stephanie
--%>

<%@page import="model.Ingredient"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/main.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Cocktail Specialist - Ingredients</title>
    </head>
    <body>
        <div class="container">
            <h1>Ingredient List</h1>
            <form name ="forward" action="AvailableCocktailServlet">
                <input type="submit" value="available" name="btSubmit"> </input>
                <input type="submit" value="save" name="btSubmit" </input>

                <table border="1">
                    <tr>
                        <th>ZutatID</th>
                        <th>Zutatname</th>
                        <th>Verfugbar</th>
                    </tr>
                    <%
                        ArrayList<Ingredient> ingredients = (ArrayList<Ingredient>) request.getAttribute("ingredients");

                        for (int i = 0; i < ingredients.size(); i++) {
                            Ingredient ingredient = ingredients.get(i);
                            out.println("<tr>");
                            out.println("<th>" + ingredient.getZutatID() + "</th>");
                            out.println("<th>" + ingredient.getZutatname() + "</th>");
                            if (ingredient.isVerfuegbarkeit() == true) {


                                out.println("<td><input type='checkbox' value='" + ingredient.getZutatID() + "' name='avail' checked> </td>");
                            } else {
                                out.println("<td><input type='checkbox' value='" + ingredient.getZutatID() + "' name='avail'> </td>");
                            }
                            out.println("</tr>");
                        }
                    %>
                </table>
            </form>
            <INPUT type=button VALUE="Zurück" onClick="history.back()">
        </div>
    </body>
</html>